import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Scanner;

public class Shiyan {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[]arr=new int[5];
        int i=0;
        System.out.println("请输入五个整数");
        try {
         while ((!scanner.hasNext("a"))){
             arr[i]=scanner.nextInt();
             i++;
         }
         if (i<5){
             throw new ArrayIndexOutOfBoundsException();
         }
       }catch (InputMismatchException e){
           System.out.println("请输入整数");
       }catch (ArrayIndexOutOfBoundsException e){
           System.out.println("数组越界，请输入五个整数");
       }finally {
            for ( i = 0; i <arr.length ; i++) {
                System.out.println("arr[i] = " + arr[i]);
            }
        }


    }
}
